package com.icoolkj.mall.user.openfeign.demo.feign;

import com.icoolkj.mall.common.Result;
import com.icoolkj.mall.user.openfeign.demo.feign.dto.OrderRequest;
import com.icoolkj.mall.user.openfeign.demo.feign.dto.OrderResponse;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//@FeignClient(name = "icoolkj-mall-order01", path = "/api/order", configuration = OpenFeignConfig.class)
@FeignClient(name = "icoolkj-mall-order01", path = "/api/order")
public interface OrderFeignService {
    @GetMapping("/getOrderByUserId")
    Result<List<OrderResponse>> getOrderByUserId(@RequestParam("userId") Long userId);


    // 使用 Feign 原生注解调用
//    @RequestLine("GET /getOrderByUserId?userId={userId}")
//    Result<List<OrderResponse>> getOrderByUserId(@Param("userId") Long userId);

//
//    @PostMapping("/post1")
//    Result<OrderResponse> post1(@RequestBody OrderRequest orderRequest);
//
//    @PostMapping("/post2")
//    Result<OrderResponse> post2(@RequestBody OrderRequest orderRequest, @RequestParam("token") String token);
//
//    @PostMapping("/post3/{userId}")
//    Result<OrderResponse> post3(@RequestBody OrderRequest orderRequest, @PathVariable("userId") Long userId);

}
